import { axios } from '@/utils/request'

export const sourceList = [
    { label: '人脉资源', value: 1 },
    { label: '资源平台', value: 3 },
    { label: '活动资源', value: 4 }
]

export const cooperationTypeMap = {
    1: '接入',
    2: '推送'
}

export const sourceMap = {
    1: '人脉资源',
    3: '资源平台',
    4: '活动资源',
}

export const apStatusMap = {
    1: '审核中',
    2: '驳回',
    3: '已合作',
}

const api = {
    marketList: '/admin/cooperationAp/marketList',
    orgResource: '/admin/cooperationAp/getOrgResource',

    proType: '/admin/cooperationAp/proType',
    selectSource: '/admin/cooperationAp/select',
    cooperationSend: '/admin/cooperationAp/add',
    cooperationInfo: '/admin/cooperationAp/info',
    applyList: '/admin/cooperationAp/list',
    cooperatedList: '/admin/cooperationAp/cooperatedList',
    cooperationDetail: '/admin/cooperationAp/get',

    cooperationApply: '/admin/cooperationAp/ap',
    cooperationCancel: '/admin/cooperationAp/cancel',

    loadPrice: '/admin/cooperationAp/loadPrice',
    priceQuery: '/admin/cooperationAp/query',
    checkPay: '/admin/cooperationAp/check'
}

export default api

/**
  * 合作市场列表
  */
export function MarketList(params) {
    return axios({
        url: api.marketList,
        method: 'get',
        params
    })
}

/**
  * 合作资源数据
  */
export function OrgResource(params) {
    return axios({
        url: api.orgResource,
        method: 'get',
        params
    })
}

/**
  * 合作列表
  */
export function ApList(params) {
    return axios({
        url: api.apList,
        method: 'get',
        params
    })
}
/**
  * 资源类型列表
  */
export function ProType(params) {
    return axios({
        url: api.proType,
        method: 'get',
        params
    })
}

/**
  * 获取选中的资源列表
  */
export function SelectSource(data) {
    return axios({
        url: api.selectSource,
        method: 'post',
        data
    })
}

/**
  * 发送申请
  */
export function CooperationSend(data) {
    return axios({
        url: api.cooperationSend,
        method: 'post',
        data
    })
}

/**
  * 查询合作详情
  */
export function CooperationInfo(params) {
    return axios({
        url: api.cooperationInfo,
        method: 'get',
        params
    })
}

/**
  * 审核列表
  */
export function ApplyList(params) {
    return axios({
        url: api.applyList,
        method: 'get',
        params
    })
}

/**
  * 合作单位列表
  */
export function CooperatedList() {
    return axios({
        url: api.cooperatedList,
        method: 'get'
    })
}

/**
  * 查看合作详情
  */
export function CooperationDetail(params) {
    return axios({
        url: api.cooperationDetail,
        method: 'get',
        params
    })
}

/**
  * 合作审核
  */
export function CooperationApply(data) {
    return axios({
        url: api.cooperationApply,
        method: 'post',
        data
    })
}

/**
  * 取消合作
  */
export function CooperationCancel(params) {
    return axios({
        url: api.cooperationCancel,
        method: 'get',
        params
    })
}

/**
  * 合作配置-加载价格
  */
export function LoadPrice(data) {
    return axios({
        url: api.loadPrice,
        method: 'post',
        data
    })
}

/**
  * 合作配置-加载价格
  */
export function PriceQuery(data) {
    return axios({
        url: api.priceQuery,
        method: 'post',
        data
    })
}

/**
  * 检测是否开通支付
  */
export function CheckPay(id) {
    return axios({
        url: api.checkPay + `?tenantId=${id}`,
        method: 'get',
    })
}
